package com.jprocms.module.cms.event;

import com.jprocms.module.cms.framework.enums.EnumChannelEvent;
import lombok.AllArgsConstructor;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.validation.annotation.Validated;

/**
 * {@link ChannelEvent} 的生产者
 *
 * @author jprocms
 */
@AllArgsConstructor
@Validated
public class ChannelEventPublisher {

    private final ApplicationEventPublisher publisher;

    public void sendChannelCreateEvent(Long id, Long parentId, Long siteId, EnumChannelEvent event) {
        ChannelEvent channelEvent = new ChannelEvent(this, id, parentId, siteId, event);
        publisher.publishEvent(channelEvent);
    }

}
